#include <iostream>
#include <math.h>
using namespace std;

// 求两点之间的距离
class Point
{
public:
    Point(double a, double b) // 构造函数
    {
        x = a;
        y = b;
    }
    void getDistance(Point &p)
    {
        cout <<sqrt((this->x - p.x) * (this->x - p.x) + (this->y - p.y) * (this->y - p.y)) << endl;
    }
    void show()
    {
        cout << "x = " << x << " y = " << y << endl;
    }
private:
    double x, y;
};

int main()
{
    Point p1(1, 2 );
    Point p2(2, 1);
    p1.show();
    p2.show();
    p1.getDistance(p2);
  

    return 0;
}